<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
  
   
    
    <h:head>
	</h:head>
	
	<body>
	<p:tabView id="tabView">
	
	 <p:tab id="tab1" title="Cadastro"> 
		<p:messages id="messages" />  
		<h:form id="frmAtor">
		<h:panelGrid columns="2" id="panelGrid">
			
			<h:outputLabel value="Nome:" for="txtNome" />
			<h:inputText  id ="txtNome" value="#{atorBean.nome}"/>		
			
		</h:panelGrid>
		<br></br>
		<h:commandButton action="#{atorBean.salvar}" value="Salvar" update="panelGrid"/>
		</h:form>
		</p:tab>
		
	<p:tab id="tab2" title="Lista"> 
		<h:form id="frmLista">
		 <p:dataTable id="tblAtor" var="c" value="#{atorBean.atores}" editable="true">
			<p:column id="nomeAtor" filterBy="#{c.nome}" headerText="Nome">
				<p:cellEditor>
				<f:facet name="output">
				<h:outputText value="#{c.nome}"/>
				</f:facet>
				<f:facet name="input">
				<h:inputText value="#{c.nome}" required="true" />
				</f:facet>
				</p:cellEditor>
			</p:column >
			
			<p:column headerText="Alterar">			
					<p:rowEditor></p:rowEditor>						
			</p:column>
			
            
			<p:column headerText="Excluir">
				<f:facet name="header"></f:facet>
				<p:commandButton action="#{atorBean.excluir}" icon="ui-icon-trash" update="tblAtor">
				 <f:param name="id" value="#{c.id}" />		
				</p:commandButton>
			</p:column>
			
		</p:dataTable>


		</h:form>		
		</p:tab>
	</p:tabView>
    </body>
</ui:composition>